dojo.provide("miaigo.model.sgf.SGFProperty");

dojo.declare(
    "miaigo.model.sgf.SGFProperty",
    null,
    {
	// Property ID, such as "W", "B"
	_id: null,
	
	// Array of values (String)
	_values: null,

	// value handler process value(s) according to type of
	// property value (defined by SGF property id)
	_valueHandler: null,

	// type of property, can be one of the following:
	// "move", "setup", "root", "info" or "none"
	_type: null,

	constructor: function(propID, propType, valueHandler)
	{
	    this._id = propID;
	    this._type = propType;
	    this._valueHandler = valueHandler;
	    this._values = new Array();
	},

	getID: function()
	{
	    return this._id;
	},

	getType: function()
	{
	    return this._type;
	},

	getValueType: function()
	{
	    return this._valueHandler.getValueType();
	},

	addValue: function(/*String*/value)
	{
	    this._values.push(value);
	},

	getRawValue: function(/* integer (optional) */index)
	{
	    if (index == null || index == undefined)
	    {
		index = 0;
	    }

	    return this.values[index];
	},

	getValue: function()
	{
	    return this._valueHandler.parseValue(this._values);
	}
    });